import type { BasicColumn, FormSchema } from '@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import * as selfFunc from './demo.func';
import { isMultiple } from 'ant-design-vue/es/vc-select/BaseSelect';

export const searchFormSchema: FormSchema[] = [
  {
    label: '单行文本',
    field: 'textInput',
    colProps: {
      span: 8,
    },
    component: 'Input',
  },
  {
    label: '数字输入框2',
    field: 'numberInput',
    colProps: {
      span: 8,
    },
    component: 'Input',
    slot: 'numberInput',
  },
  {
    label: '字典下拉',
    field: 'dictSelect',
    colProps: {
      span: 8,
    },
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'org_category',
      stringToNumber: true,
    },
  },
  {
    label: '字典表下拉搜索框',
    field: 'dictSelectSearch',
    colProps: {
      span: 8,
    },
    component: 'JDictSelectTag',
    componentProps: {
      type: 'select',
      dict: 'sys_user,username,id',
      params: { username: 'aaa' },
    },
  },
  {
    label: '下拉多选',
    field: 'selectMulti',
    colProps: {
      span: 8,
    },
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: 'company_rank',
      stringToNumber: true,
    },
  },
  {
    label: '字典单选',
    field: 'dictRadio',
    colProps: {
      span: 8,
    },
    component: 'JDictSelectTag',
    componentProps: {
      type: 'radio',
      dictCode: 'position_rank',
      stringToNumber: true,
    },
  },
  {
    label: '字典复选框',
    field: 'dictCheckBox',
    colProps: {
      span: 8,
    },
    component: 'JCheckbox',
    componentProps: {
      dictCode: 'position_rank',
    },
  },
  {
    label: '开关',
    field: 'dictSwitch',
    colProps: {
      span: 8,
    },
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'is_open',
      stringToNumber: true,
    },
  },
  {
    label: '年月日',
    field: 'dateYmd',
    colProps: {
      span: 8,
    },
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
    },
  },
  {
    label: '月份',
    field: 'dateYmdhms',
    colProps: {
      span: 8,
    },
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
    },
  },
  {
    label: '时分秒',
    field: 'dateHms',
    colProps: {
      span: 8,
    },
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
    },
  },
  {
    label: '选择部门',
    field: 'deptId',
    colProps: {
      span: 8,
    },
    component: 'JSelectDept',
  },
  {
    label: '选择用户',
    field: 'userName',
    colProps: {
      span: 8,
    },
    component: 'JSelectUserByDept',
  },
  {
    label: '选择角色',
    field: 'roleId',
    colProps: {
      span: 8,
    },
    component: 'JSelectRole',
  },
];

export const columns: BasicColumn[] = [
  {
    title: '单行文本',
    dataIndex: 'textInput',
    align: 'center',
  },
  {
    title: '数字输入框2',
    dataIndex: 'numberInput',
    align: 'center',
  },
  {
    title: '字典下拉',
    dataIndex: 'dictSelectTxt',
    align: 'center',
  },
  {
    title: '字典表下拉搜索框',
    dataIndex: 'dictSelectUsername',
    align: 'center',
  },
  {
    title: '下拉多选',
    dataIndex: 'selectMultiTxt',
    align: 'center',
  },
  {
    title: '字典单选',
    dataIndex: 'dictRadioTxt',
    align: 'center',
  },
  {
    title: '字典复选框',
    dataIndex: 'dictCheckBoxTxt',
    align: 'center',
  },
  {
    title: '开关',
    dataIndex: 'dictSwitchTxt',
    align: 'center',
    customRender: selfFunc.renderDictSwitch,
  },
  {
    title: '年月日',
    dataIndex: 'dateYmd',
    align: 'center',
  },
  {
    title: '月份',
    dataIndex: 'dateYmdhms',
    align: 'center',
  },
  {
    title: '时分秒',
    dataIndex: 'dateHms',
    align: 'center',
  },
  {
    title: '上传文件',
    dataIndex: 'filePath',
    align: 'center',
  },
  {
    title: '上传图片',
    dataIndex: 'imgPath',
    align: 'center',
    customRender: render.renderImg,
  },
  {
    title: '选择部门',
    dataIndex: 'deptName',
    align: 'center',
  },
  {
    title: '选择用户',
    dataIndex: 'realname',
    align: 'center',
  },
  {
    title: '选择角色',
    dataIndex: 'roleName',
    align: 'center',
  },
  {
    title: '省市区级联',
    dataIndex: 'pca1',
    align: 'center',
  },
  {
    title: '省市区联动',
    dataIndex: 'pca2',
    align: 'center',
  },
  {
    title: '下拉树',
    dataIndex: 'selectTreeTxt',
    align: 'center',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    align: 'center',
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    align: 'center',
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input',
  },
  {
    label: '单行文本',
    field: 'textInput',
    colProps: {
      span: 12,
    },
    component: 'Input',
  },
  {
    label: '数字输入框2',
    field: 'numberInput',
    colProps: {
      span: 12,
    },
    component: 'InputNumber',
  },
  {
    label: '密码',
    field: 'pswordInput',
    colProps: {
      span: 12,
    },
    component: 'InputPassword',
  },
  {
    label: '多行文本框',
    field: 'textarea',
    colProps: {
      span: 12,
    },
    component: 'InputTextArea',
  },
  {
    label: '字典下拉',
    field: 'dictSelect',
    colProps: {
      span: 12,
    },
    component: 'JDictSelectTag',
    componentProps: {
      type: 'select',
      dictCode: 'org_category',
    },
  },
  {
    label: '字典表下拉搜索框',
    field: 'dictSelectSearch',
    colProps: {
      span: 12,
    },
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'sys_user,username,id',
      params: {
        username: 'aaa',
      },
    },
  },
  {
    label: '下拉多选',
    field: 'selectMulti',
    colProps: {
      span: 12,
    },
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: 'company_rank',
    },
  },
  {
    label: '字典单选',
    field: 'dictRadio',
    colProps: {
      span: 12,
    },
    component: 'JDictSelectTag',
    componentProps: {
      type: 'radio',
      dictCode: 'position_rank',
    },
  },
  {
    label: '字典复选框',
    field: 'dictCheckBox',
    colProps: {
      span: 12,
    },
    component: 'JCheckbox',
    componentProps: {
      dictCode: 'position_rank',
    },
  },
  {
    label: '开关',
    field: 'dictSwitch',
    colProps: {
      span: 12,
    },
    component: 'JSwitch',
  },
  {
    label: '年月日',
    field: 'dateYmd',
    colProps: {
      span: 12,
    },
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD hh:mm',
    },
  },
  {
    label: '月份',
    field: 'dateYmdhms',
    colProps: {
      span: 12,
    },
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD hh:mm',
    },
  },
  {
    label: '时分秒',
    field: 'dateHms',
    colProps: {
      span: 12,
    },
    component: 'DatePicker',
  },
  {
    label: '上传文件',
    field: 'filePath',
    colProps: {
      span: 12,
    },
    component: 'JUpload',
    componentProps: {
      bizPath: 'demo/demo',
    },
  },
  {
    label: '上传图片',
    field: 'imgPath',
    colProps: {
      span: 12,
    },
    component: 'JImageUpload',
    componentProps: {
      bizPath: 'demo/demo',
      fileType: 'image',
    },
  },
  {
    label: '选择部门',
    field: 'deptId',
    colProps: {
      span: 12,
    },
    component: 'JSelectDept',
  },
  {
    label: '选择用户',
    field: 'userName',
    componentProps: {
      isRadioSelection: true,
      //buttonIcon:'ant-design:search-outlined',
    },
    colProps: {
      span: 12,
    },
    component: 'JSelectUserByDept',
    
  },
  {
    label: '选择角色',
    field: 'roleId',
    colProps: {
      span: 12,
    },
    component: 'JSelectRole',
  },
  {
    label: '选择供应商',
    field: 'supplierId',
    colProps: {
      span: 12,
    },
    component: 'JSelectSupplierByType',
    componentProps: {
      isRadioSelection:true,
    },
  },
  {
    label: '省市区级联',
    field: 'pca1',
    colProps: {
      span: 12,
    },
    component: 'JAreaSelect',
  },
  {
    label: '省市区联动',
    field: 'pca2',
    colProps: {
      span: 12,
    },
    component: 'JAreaLinkage',
  },
  {
    label: '下拉树',
    field: 'selectTree',
    colProps: {
      span: 12,
    },
    component: 'JTreeSelect',
    componentProps: {
      dict: 'gene_tree,title,id',
      hasChildField: 'is_leaf',
      pidValue: '0',
      pidField: 'parent_id',
      converIsLeafVal: 0,
    },
  },
  {
    label: '富文本',
    field: 'textEditor',
    colProps: {
      span: 24,
    },
    component: 'JEditor',
  },
  {
    label: '代码编辑器',
    field: 'codeEditor',
    colProps: {
      span: 24,
    },
    component: 'JEditor',
  },
];
